package com.bjpowernode.shop.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.ObjectUtils;

import java.util.HashMap;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxMsg {
    private String userId;
    private String touser; // OPENID
    private String template_id; // 模板ID
    private String url; // 点击公众号消息，跳转的地址
    private String topcolor; // 顶部标签颜色
    private Map<String, Object> data;

    public void append(String key, String value, String color) {
        if (ObjectUtils.isEmpty(data))
            data = new HashMap<>();
        Map<String, String> subData = new HashMap<>();
        subData.put("value", value);
        subData.put("color", color);
        
        data.put(key, subData);
    }
}
